<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>归档天数管理</title>

<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
	<div class="searchArea">
		<!-- 搜索表单开始 -->
		<form id="searchBar">
			<div class="fieldset1 clearFix">
				<div class="FXBR">
					<div class="fieldBox">
						<div class="label">归档天数</div>
						<div class="field">
<!-- 						class="ui-datepicker" -->
							<input type="text" name="beginPigeonholeDays"  id="beginPigeonholeDays" data-value="" onblur="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}">
							至
							<input type="text" name="endPigeonholeDays" id="endPigeonholeDays" data-value="" onblur="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}">
						</div>
					</div>
					<div class="fieldBox">
                        <div class="label">事业部</div>
                        <div class="field">
<!--                             <input name="bussDepartment" id="bussDepartment" data-value="" placeholder="请选择" ltype="combobox"> -->
                        	<select id="bussDepartment"  name="bussDepartment"  ligerui="width: 160">
								<option value="">请选择</option>
								<c:forEach items="${buOrgCdList}" var="item">
									<option value="${item.key}">${item.value}</option>
								</c:forEach>
							</select>
                        </div>
					</div>
					<div class="fieldBox col_33" id="cstMgrOrgCdId" >
		                <div class="label">省公司</div>
		                <div class="field">
		                    <input name="proCompany" id="proCompany" type="text" class="ui-textbox" value="">
		                </div>
		            </div>
					
				</div>
				
				<div class="clearFix"></div>
				
				<!-- 表单按钮 -->
				<div class="btnsBox formBtns notRight">
					<span id="searchBtn" class="sq-button-round" onclick="searchBtnEvent()">查询</span>
					<span id="clearBtn" class="sq-button-round" onclick="clearBtnEvent();">清空</span>
					<span id="addBtn" class="sq-button-round" onclick="add();">新增</span>
					
	            </div>
	           
			</div>
		</form>
		<!-- 搜索表单结束 -->
	</div>
</div>

<!-- 列表显示块 -->
<div id="ligergrid1" class="sq-grid"></div>

<script type="text/javascript">
	$(function () {
		initOrgTree();
		$("#searchBar").ligerForm();//初始化表单
		$("#ligergrid1").ligerGrid({
			url:'<%=path%>/archive/arcDayMaintain/initList.do',
			method:'get',
			parms:getSearchParams(),
			columns:[
				{display: '事业部', name: 'bussDepartment', Width: 250, align: 'center', enabledSort:true},
				{display: '省公司', name: 'proCompany', width: 330, align: 'center', enabledSort:true},
				{display: '归档天数', name: 'arcDay', width: 350, align:'center', enabledSort:true},
				getGridOperColumnContent()//操作列
			],
			pageSize:10,
			root:'rows',
			record:'total',
			hideLoadButton:false,
			width:'100%',
			height:'100%',
			heightDiff:-2,
// 			checkbox:true,//列表是否有选择框
			rownumbers:true//列表是否有行号
		});
		grid = liger.get("ligergrid1");
// 		//事业部
//         $("#bussDepartment").ligerComboBox({
//             valueField: 'key',
//             textField: 'value'
//         });
//         liger.get("bussDepartment").setData(${buOrgCdList});
//         //省公司
//         $("#proCompany").ligerComboBox({
//             valueField: 'key',
//             textField: 'value'
//         });
//         liger.get("proCompany").setData(${sysOrgVOList});
		grid.setHeight(100);
		
		$("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
//             alert(JSON.stringify(data));
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });
	
	});
	
	
	//查询参数
	function getSearchParams(){
		var form = new liger.get("searchBar");
		var data = form.getData();
		return data;
	}
	
	
	
	//隐藏掉操作列
    function getGridOperColumnContent(){
		var data = {
			display:'操作',
			isSort:false,
			width:200,
			align:'center',
			render:function (rowdata, rowindex, value){
				var h="";
				h+='<a class="sq-button-hasicon" alt="查看" href="javascript:showRenew(';
				h+="'"+rowdata.id+"'";
				h+=")\"><i class=\"sqBtnIco_4\"></i>查看</a>";
            	h+='<a class="sq-button-hasicon" alt="修改" href="javascript:modifyRow(';
                h+="'"+rowdata.id+"'";
                h+=")\"><i class=\"sqBtnIco_4\"></i>"+LogUtils.LOG_CMM_GRID_BTN_MODIFY+"</a>";
				return h;
			}
		};
		return data;
	}
	
	//清空按钮事件
	function clearBtnEvent(){
		$('#searchBar :input[name]').each(
			function () {
				$(this).val('');
			}
		);
// 		$("#bussDepartment").val("");
// 		$("#proCompany").val("");
		var form = liger.get("searchBar");
		form.setData({  //重置select等特殊表单
			"bussDepartment":"",
			"proCompany":""
		});
	}
	
	
	//新增归档信息
	function add() {
		//回调刷新列表
		var callback = function () {
			grid.reload();
		};
		Add_navTab("Ass_1"+Date.parse(new Date()), "新增归档信息", '<%=path%>/archive/arcDayMaintain/toAddPage.do?' , callback);
	}
	
	//修改归档天数信息
	function modifyRow(_id){
		//回调刷新列表
		var callback = function () {
			grid.reload();
		};
		if(!_id){
			return;
		}//归档ID为空不执行
		Add_navTab('Ass_2'+_id,'修改归档天数信息','<%=path%>/archive/arcDayMaintain/toAddPage.do?id='+_id+'&flag=2' , callback);
	}
	

	//查看归档天数信息
	function showRenew(_id){
		//回调刷新列表
		var callback = function () {
			grid.reload();
		};
		if(!_id){
			return;
		}//归档天数ID为空不执行
		Add_navTab('Ass_4'+_id,'查看归档天数信息','<%=path%>/archive/arcDayMaintain/toAddPage.do?id='+_id+'&flag=1' , callback);
	}
	
	function initOrgTree(){
    	var params = {};
    	 searchOrgTree = $("#proCompany").ligerComboBox({
    		 width: 480,
             selectBoxWidth: 480,
             selectBoxHeight: 150,
             //限制只能选叶节点，父节点不能点击
             treeLeafOnly: false,
             valueField: 'orgCd',
             textField: 'orgDispNm',
             showTreePath: true,
             tree: {
                 ajaxType: 'get',
                 idFieldName:'orgCd',
                 textFieldName: 'orgDispNm',
                 checkbox: false,
                 parentIcon: "none",
                 childIcon: "none",
                 needCancel : false
             }
         });
    	 $.ajax({
     		type: 'get',
     		dataType:'json',
     		data: params,
     		url: '<%=path%>/warrant/warrantfilemanage/searchBuOrgTree.do',
     		success:function(msg){
     			if(msg.success == 1){
     				searchOrgTree.treeManager.setData(msg.data);
     				searchOrgTree.clear();
     				searchOrgTree.setValue('${proCompany}');
     			}else{
     				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
     			}
     		}
     	});

    }    
	        
	
	
	
</script>
</body>
</html>